﻿Public Class Form1
  Private Sub btnConnetti_Click(
        ByVal sender As System.Object,
        ByVal e As System.EventArgs) _
        Handles btnConnetti.Click
    If Me.SqlConnection1.State = 0 Then
      Me.SqlConnection1.ConnectionString =
        "Integrated Security=SSPI;" &
        "Persist Security Info=False;" &
        "User ID='sa';" &
        "Initial Catalog=03_Customers_and_Orders;" &
        "Data Source=HP;" &
        "Initial File Name=''"
      Me.SqlConnection1.Open()
    End If
    Me.Label1.Text = "Connesso"
  End Sub

  Private Sub btnDisconnetti_Click(
        ByVal sender As System.Object,
        ByVal e As System.EventArgs) _
        Handles btnDisconnetti.Click
    If Me.SqlConnection1.State = 1 Then
      Me.SqlConnection1.Close()
    End If
    Me.Label1.Text = "Disconnesso"
  End Sub
End Class
